package prepare.huawei;

import java.util.Scanner;

/**
 * description: <a href="https://blog.csdn.net/qq_39132095/article/details/129505737">执行时长</a>
 *
 * @author <a href="zhaoyingling12@163.com">simon zhao</a>
 * @since 2023/3/23
 */
public class ExecutionDuration {

    public static void main(String[] args) {
        Scanner input = new Scanner(System.in);
        // gpu 的处理能力
        int c = Integer.parseInt(input.nextLine());
        int n = Integer.parseInt(input.nextLine());
        int[] tasks = new int[n];
        String[] sts = input.nextLine().split(" ");
        for (int i = 0; i < sts.length; i++) {
            tasks[i] = Integer.parseInt(sts[i]);
        }
        int rest = 0, seconds = 0;
        for (int t : tasks) {
            seconds++;
            rest = rest + t <= c ? 0 : rest + t - c;
        }
        System.out.println("rest = " + rest);
        if (rest != 0) {
            // 判断是否能整除
            seconds = rest % c == 0 ? rest / c : rest / c + 1;
        }
        System.out.println(seconds);
    }
}
